home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Burning & Media
/
GB-PVR 1.2.13
/
GBPVR10213.msi
/
Cabs.w1.cab
/
Stub_Library_aspx_cs.cs55
< prev
next >
Wrap
Text File
|
2007-02-18
|
3KB
|
99 lines
//===========================================================================
// This file was generated as part of an ASP.NET 2.0 Web project conversion.
// This code file 'App_Code\Migrated\Stub_Library_aspx_cs.cs' was created and contains an abstract class
// used as a base class for the class 'Migrated_Library' in file 'Library.aspx.cs'.
// This allows the the base class to be referenced by all code files in your project.
// For more information on this code pattern, please refer to http://go.microsoft.com/fwlink/?LinkId=46995
//===========================================================================
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using GBPVR.Public;
namespace gbweb
{
abstract public class Library : System.Web.UI.Page
{
public static string GetRealPath(string vpath)
{
string[] pathparts = vpath.Split(new char[] {'/'}, 3);
string Mode = CultureInfo.CurrentUICulture.TextInfo.ToTitleCase(pathparts[0]);
Hashtable directories = (Hashtable)HttpContext.Current.Session[Mode + "LibraryDirectories"];
if (directories == null)
{
string directorylist = "Video~|Music~";
XmlNode node = Global.Config.SelectSingleNode("/settings/" + Mode + "LibraryDirectory");
if (node != null)
{
directorylist = node.InnerText;
}
string[] directorymappings = directorylist.Split('|');
directories = new Hashtable();
foreach (string directorymapping in directorymappings)
{
string[] mapping = directorymapping.Split('~');
if ((directorymapping.Length > 0) && (mapping.Length > 1))
directories[mapping[0]] = mapping[1];
}
HttpContext.Current.Session[Mode + "LibraryDirectories"] = directories;
}
string path = null;
if (pathparts.Length == 2)
{
path = (string)directories[pathparts[1]];
}
else if (pathparts.Length == 3)
{
path = Path.Combine((string)directories[pathparts[1]], pathparts[2].Replace('/', Path.DirectorySeparatorChar));
}
return path;
}
public static Regex GetRegex(string mode)
{
string filterRegex;
switch (mode.ToLower())
{
case "video":
filterRegex = Global.Settings.videoFiles;
break;
case "music":
filterRegex = Global.Settings.musicFiles;
break;
case "photo":
filterRegex = Global.Settings.photoFiles;
break;
default:
filterRegex = string.Empty;
break;
}
return new Regex(filterRegex, RegexOptions.Compiled | RegexOptions.IgnoreCase);
}
}
}